package com.shop.loan.model;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.AttachmentType;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

@Setter
@Getter
@Entity
@Table(name = "s_loan_order_sign_log")
@Erupt(
        name = "订单电子签",
        power = @Power(add = false, edit = false, delete = false)

)
public class LoanOrderSignLog extends BaseModel {


    @Column(name = "order_id")
    private Long orderId;


    @EruptField(
            views = @View(title = "合同编号"),
            edit = @Edit(title = "合同编号"
            )
    )
    private String contractNo;

    @EruptField(
            views = @View(title = "用户签署链接", type = ViewType.QR_CODE),
            edit = @Edit(title = "用户签署链接")
    )
    private String userSignUrl;

    @EruptField(
            views = @View(title = "用户签署状态", width = "140px"),
            edit = @Edit(
                    title = "用户签署状态",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "等待签署", value = "0"),
                                    @VL(label = "签署中", value = "1"),
                                    @VL(label = "已签署", value = "2"),
                                    @VL(label = "过期", value = "3"),
                                    @VL(label = "拒签", value = "4"),
                                    @VL(label = "作废", value = "6"),
                                    @VL(label = "撤销", value = "7"),
                            }
                    ))
    )
    private Integer userSignStatus;


    @EruptField(
            views = @View(title = "生成时间"),
            edit = @Edit(title = "生成时间",
                    readonly = @Readonly,
                    dateType = @DateType(type = DateType.Type.DATE_TIME))
    )
    private Date createTime;

    @EruptField(
            views = @View(title = "签署合同文件", type = ViewType.ATTACHMENT),
            edit = @Edit(
                    title = "签署合同文件",
                    type = EditType.ATTACHMENT,
                    readonly = @Readonly,
                    attachmentType = @AttachmentType(type = AttachmentType.Type.BASE))
    )
    private String signFileUrl;


}
